package org.zjx.operation;

import java.util.ArrayList;
import java.util.List;

/**
 * 顺序执行多个操作
 */
public class SequenceOperation implements WindowOperation<Void> {
    private final List<WindowOperation<?>> operations;

    public SequenceOperation() {
        this.operations = new ArrayList<>();
    }

    public SequenceOperation add(WindowOperation<?> operation) {
        operations.add(operation);
        return this; // 支持链式调用
    }

    @Override
    public Void execute(OperationExecutor executor) {
        for (WindowOperation<?> operation : operations) {
            operation.execute(executor);
        }
        return null;
    }
}